<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;




/**
 * 开奖结果控制器
 */
class LotteryResult extends AdminBase
{

    /**
     * 开奖结果列表
     */
    public function LotteryResultList()
    {

        $where = $this->logicLotteryResult->getWhere($this->param);
        $this->assign('list', $this->logicLotteryResult->getLotteryResultList($where, 'a.*,c.name as category_name', 'a.create_time desc'));
        $this->assign('cate',\app\common\model\Lottery::all(['status'=>1]));
        $this->assign('param',$this->param);
        return $this->fetch('lottery_result_list');
    }



    /**
     * 开奖结果添加
     */
    public function LotteryResultAdd()
    {

        $this->LotteryResultCommon();
        $this->assign('cate',\app\common\model\Lottery::all(['status'=>1]));
        return $this->fetch('lottery_result_edit');
    }

    /**
     * 开奖结果编辑
     */
    public function LotteryResultEdit()
    {

        $this->LotteryResultCommon();

        $info = $this->logicLotteryResult->getLotteryResultInfo(['a.id' => $this->param['id']], 'a.*,c.name as category_name');

        $this->assign('cate',\app\common\model\Lottery::all(['status'=>1]));
        $this->assign('info', $info);

        return $this->fetch('lottery_result_edit');
    }








    /**
     * 开奖结果添加与编辑通用方法
     */
    public function LotteryResultCommon()
    {

        IS_POST && $this->jump($this->logicLotteryResult->LotteryResultEdit($_POST));
        $this->assign('param',  $this->param);
    }






    /**
     * 数据状态设置
     */
    public function setStatus()
    {

        $this->jump($this->logicAdminBase->setStatus('LotteryResult', $this->param));
    }


    /**
     * 数据状态设置
     */
    public function update_info()
    {
        $this->jump($this->logicLotteryResult->update_info($this->param));
    }




}
